package com.ruoyi.omp.api;

import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.omp.api.domain.BuiRoom;
import com.ruoyi.omp.api.factory.RemoteRoomFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author: cjie
 * @description: 房屋信息服务
 * @date: 2021/8/16
 */
@FeignClient(contextId = "remoteRoomService", value = ServiceNameConstants.OMP_PARK_SERVICE, fallbackFactory =
        RemoteRoomFactory.class)
public interface RemoteRoomService {

    /**
     * 通过租赁记录id查询房屋列表
     * @param buiRoom 房屋信息
     * @return
     */
    @PostMapping(value = "/buiRoom/listRoom")
    R<List<BuiRoom>> listRoom(@RequestBody BuiRoom buiRoom);

    @GetMapping(value = "/buiRoom/roomInfo/{roomNum}")
    R<BuiRoom> getBuiRoomByNum(@PathVariable("roomNum") String roomNum);

    /**
     * 查询房屋详情
     * @param roomId 房屋id
     * @return
     */
    @GetMapping(value = "/buiRoom/info/{roomId}")
    R<BuiRoom> getBuiRoom(@PathVariable("roomId") String roomId);

    /**
     * 修改房屋信息
     * @param buiRoom 房屋信息
     * @return
     */
    @PostMapping(value = "/buiRoom/updateRoom")
    R updateRoom(@RequestBody BuiRoom buiRoom);

    /**
     * 通过租赁记录id查询租赁总面积
     * @param recordId 租赁记录id
     * @return
     */
    @GetMapping(value = "/buiRoom/sumArea/{recordId}")
    R<BigDecimal> sumRoomAreaByRecordId(@PathVariable("recordId") String recordId);

    /**
     * 通过租赁记录id查询房屋数量
     * @param recordId 租赁记录id
     * @return
     */
    @GetMapping(value = "/buiRoom/countRoom/{recordId}")
    R<Integer> countRoomByRecordId(@PathVariable("recordId") String recordId);
}
